<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
  Class: BigIPCookie::Decode
  
    &mdash; Documentation by YARD 0.9.20
  
</title>

  <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />

  <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  pathId = "BigIPCookie::Decode";
  relpath = '../';
</script>


  <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>


  </head>
  <body>
    <div class="nav_wrap">
      <iframe id="nav" src="../class_list.html?1"></iframe>
      <div id="resizer"></div>
    </div>

    <div id="main" tabindex="-1">
      <div id="header">
        <div id="menu">
  
    <a href="../_index.html">Index (D)</a> &raquo;
    <span class='title'><span class='object_link'><a href="../BigIPCookie.html" title="BigIPCookie (class)">BigIPCookie</a></span></span>
     &raquo; 
    <span class="title">Decode</span>
  
</div>

        <div id="search">
  
    <a class="full_list_link" id="class_list_link"
        href="../class_list.html">

        <svg width="24" height="24">
          <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
          <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
          <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
        </svg>
    </a>
  
</div>
        <div class="clear"></div>
      </div>

      <div id="content"><h1>Class: BigIPCookie::Decode
  
  
  
</h1>
<div class="box_info">
  
  <dl>
    <dt>Inherits:</dt>
    <dd>
      <span class="inheritName">Object</span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">BigIPCookie::Decode</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
    </dd>
  </dl>
  

  
  
  
  
  

  

  
  <dl>
    <dt>Defined in:</dt>
    <dd>lib/bigipcookie.rb</dd>
  </dl>
  
</div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    
<p>The class to decode BigIP cookies</p>


  </div>
</div>
<div class="tags">
  
  <div class="examples">
    <p class="tag_title">Examples:</p>
    
      
      <pre class="example code"><code><span class='id identifier rubyid_bip'>bip</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../BigIPCookie.html" title="BigIPCookie (class)">BigIPCookie</a></span></span><span class='op'>::</span><span class='const'>Decode</span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="#initialize-instance_method" title="BigIPCookie::Decode#initialize (method)">new</a></span></span><span class='lparen'>(</span>
  <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>CustomeCookieName=vi20010112000000000000000000000030.20480</span><span class='tstring_end'>&#39;</span></span>
<span class='rparen'>)</span>
<span class='id identifier rubyid_bip'>bip</span><span class='period'>.</span><span class='id identifier rubyid_auto_decode'>auto_decode</span><span class='lparen'>(</span><span class='label'>ipv6compression:</span> <span class='int'>0</span><span class='rparen'>)</span>
<span class='id identifier rubyid_bip'>bip</span><span class='period'>.</span><span class='id identifier rubyid_decoded_cookie'>decoded_cookie</span>
<span class='id identifier rubyid_bip'>bip</span><span class='period'>.</span><span class='id identifier rubyid_pool_name'>pool_name</span>
<span class='id identifier rubyid_bip'>bip</span><span class='period'>.</span><span class='id identifier rubyid_cookie_type'>cookie_type</span></code></pre>
    
  </div>


</div>



  <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
  <ul class="summary">
    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#cookie_type-instance_method" title="#cookie_type (instance method)">#<strong>cookie_type</strong>  &#x21d2; String </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>The type of the cookie.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#decoded_cookie-instance_method" title="#decoded_cookie (instance method)">#<strong>decoded_cookie</strong>  &#x21d2; String </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>The decoded cookie value.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#pool_name-instance_method" title="#pool_name (instance method)">#<strong>pool_name</strong>  &#x21d2; String </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>The pool name.</p>
</div></span>
  
</li>

    
      <li class="public ">
  <span class="summary_signature">
    
      <a href="#raw_cookie-instance_method" title="#raw_cookie (instance method)">#<strong>raw_cookie</strong>  &#x21d2; String </a>
    

    
  </span>
  
  
  
    
      <span class="note title readonly">readonly</span>
    
    
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>The raw cookie (as provided).</p>
</div></span>
  
</li>

    
  </ul>




  
    <h2>
      Instance Method Summary
      <small><a href="#" class="summary_toggle">collapse</a></small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#auto_decode-instance_method" title="#auto_decode (instance method)">#<strong>auto_decode</strong>(opts = {})  &#x21d2; Object </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Automatically decode the raw cookie, detects if there is a cookie key   (custom or default) or only the value.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(cookie)  &#x21d2; Decode </a>
    

    
  </span>
  
  
    <span class="note title constructor">constructor</span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>A new instance of cookie.</p>
</div></span>
  
</li>

      
    </ul>
  

<div id="constructor_details" class="method_details_list">
  <h2>Constructor Details</h2>
  
    <div class="method_details first">
  <h3 class="signature first" id="initialize-instance_method">
  
    #<strong>initialize</strong>(cookie)  &#x21d2; <tt><span class='object_link'><a href="" title="BigIPCookie::Decode (class)">Decode</a></span></tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>A new instance of cookie</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>cookie</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>the raw cookie, either key/value or only the value</p>
</div>
      
    </li>
  
</ul>


</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


43
44
45
46
47
48</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/bigipcookie.rb', line 43</span>

<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_cookie'>cookie</span><span class='rparen'>)</span>
  <span class='ivar'>@raw_cookie</span> <span class='op'>=</span> <span class='id identifier rubyid_cookie'>cookie</span>
  <span class='ivar'>@pool_name</span> <span class='op'>=</span> <span class='kw'>nil</span>
  <span class='ivar'>@decoded_cookie</span> <span class='op'>=</span> <span class='kw'>nil</span>
  <span class='ivar'>@cookie_type</span> <span class='op'>=</span> <span class='kw'>nil</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
  
</div>

  <div id="instance_attr_details" class="attr_details">
    <h2>Instance Attribute Details</h2>
    
      
      <span id=""></span>
      <div class="method_details first">
  <h3 class="signature first" id="cookie_type-instance_method">
  
    #<strong>cookie_type</strong>  &#x21d2; <tt>String</tt>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Returns the type of the cookie</p>


  </div>
</div>
<div class="tags">
  
  <div class="examples">
    <p class="tag_title">Examples:</p>
    
      
      <pre class="example code"><code><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>IPv6 pool members in non-default route domains</span><span class='tstring_end'>&#39;</span></span></code></pre>
    
  </div>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>the type of the cookie</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


39
40
41</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/bigipcookie.rb', line 39</span>

<span class='kw'>def</span> <span class='id identifier rubyid_cookie_type'>cookie_type</span>
  <span class='ivar'>@cookie_type</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id=""></span>
      <div class="method_details ">
  <h3 class="signature " id="decoded_cookie-instance_method">
  
    #<strong>decoded_cookie</strong>  &#x21d2; <tt>String</tt>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Returns the decoded cookie value</p>


  </div>
</div>
<div class="tags">
  
  <div class="examples">
    <p class="tag_title">Examples:</p>
    
      
      <pre class="example code"><code><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>[2001:112::30%3]:80</span><span class='tstring_end'>&#39;</span></span></code></pre>
    
  </div>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>the decoded cookie value</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


34
35
36</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/bigipcookie.rb', line 34</span>

<span class='kw'>def</span> <span class='id identifier rubyid_decoded_cookie'>decoded_cookie</span>
  <span class='ivar'>@decoded_cookie</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id=""></span>
      <div class="method_details ">
  <h3 class="signature " id="pool_name-instance_method">
  
    #<strong>pool_name</strong>  &#x21d2; <tt>String</tt>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Returns the pool name</p>


  </div>
</div>
<div class="tags">
  
<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>the pool name</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


29
30
31</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/bigipcookie.rb', line 29</span>

<span class='kw'>def</span> <span class='id identifier rubyid_pool_name'>pool_name</span>
  <span class='ivar'>@pool_name</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      
      <span id=""></span>
      <div class="method_details ">
  <h3 class="signature " id="raw_cookie-instance_method">
  
    #<strong>raw_cookie</strong>  &#x21d2; <tt>String</tt>  <span class="extras">(readonly)</span>
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Returns the raw cookie (as provided)</p>


  </div>
</div>
<div class="tags">
  
  <div class="examples">
    <p class="tag_title">Examples:</p>
    
      
      <pre class="example code"><code><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>BIGipServer~SuperPool=rd3o20010112000000000000000000000030o80</span><span class='tstring_end'>&#39;</span></span></code></pre>
    
  </div>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>the raw cookie (as provided)</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


26
27
28</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/bigipcookie.rb', line 26</span>

<span class='kw'>def</span> <span class='id identifier rubyid_raw_cookie'>raw_cookie</span>
  <span class='ivar'>@raw_cookie</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>


  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="auto_decode-instance_method">
  
    #<strong>auto_decode</strong>(opts = {})  &#x21d2; <tt>Object</tt> 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
  <div class="note notetag">
    <strong>Note:</strong>
    <div class='inline'>
<p>.yardopts-dev must be used to get <span class='object_link'>#decode_ip</span> documentation</p>
</div>
  </div>


<p>Automatically decode the raw cookie, detects if there is a cookie key</p>

<pre class="code ruby"><code class="ruby"><span class='lparen'>(</span><span class='id identifier rubyid_custom'>custom</span> <span class='kw'>or</span> <span class='id identifier rubyid_default'>default</span><span class='rparen'>)</span> <span class='kw'>or</span> <span class='id identifier rubyid_only'>only</span> <span class='id identifier rubyid_the'>the</span> <span class='id identifier rubyid_value'>value</span>
</code></pre>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>opts</span>
      
      
        <span class='type'>(<tt>Hahs</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>{}</tt>)</em>
      
      
        &mdash;
        <div class='inline'>
<p>see <span class='object_link'>#decode_ip</span></p>
</div>
      
    </li>
  
</ul>


</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/bigipcookie.rb', line 236</span>

<span class='kw'>def</span> <span class='id identifier rubyid_auto_decode'>auto_decode</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='kw'>if</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\=</span><span class='regexp_end'>/</span></span><span class='period'>.</span><span class='id identifier rubyid_match?'>match?</span><span class='lparen'>(</span><span class='ivar'>@raw_cookie</span><span class='rparen'>)</span> <span class='comment'># if there is a key
</span>    <span class='kw'>if</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^BIGipServer</span><span class='regexp_end'>/</span></span><span class='period'>.</span><span class='id identifier rubyid_match?'>match?</span><span class='lparen'>(</span><span class='ivar'>@raw_cookie</span><span class='rparen'>)</span> <span class='comment'># if default cookie name
</span>      <span class='id identifier rubyid_pool_name'>pool_name</span> <span class='op'>=</span> <span class='id identifier rubyid_retrieve_pool_name'>retrieve_pool_name</span>
      <span class='id identifier rubyid_cookie_value'>cookie_value</span> <span class='op'>=</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^BIGipServer.*?=(.+)</span><span class='regexp_end'>/</span></span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='ivar'>@raw_cookie</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_captures'>captures</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
      <span class='id identifier rubyid_decoded_cookie'>decoded_cookie</span> <span class='op'>=</span> <span class='id identifier rubyid_decode_cookie'>decode_cookie</span><span class='lparen'>(</span><span class='id identifier rubyid_cookie_value'>cookie_value</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
      <span class='ivar'>@pool_name</span> <span class='op'>=</span> <span class='id identifier rubyid_pool_name'>pool_name</span>
    <span class='kw'>else</span> <span class='comment'># custom cookie name
</span>      <span class='id identifier rubyid_cookie_value'>cookie_value</span> <span class='op'>=</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>.*?=(.+)</span><span class='regexp_end'>/</span></span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='ivar'>@raw_cookie</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_captures'>captures</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
      <span class='id identifier rubyid_decoded_cookie'>decoded_cookie</span> <span class='op'>=</span> <span class='id identifier rubyid_decode_cookie'>decode_cookie</span><span class='lparen'>(</span><span class='id identifier rubyid_cookie_value'>cookie_value</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
      <span class='ivar'>@pool_name</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>unknown</span><span class='tstring_end'>&#39;</span></span>
    <span class='kw'>end</span>
  <span class='kw'>else</span> <span class='comment'># cookie value only
</span>    <span class='id identifier rubyid_decoded_cookie'>decoded_cookie</span> <span class='op'>=</span> <span class='id identifier rubyid_decode_cookie'>decode_cookie</span><span class='lparen'>(</span><span class='ivar'>@raw_cookie</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
    <span class='ivar'>@pool_name</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>unknown</span><span class='tstring_end'>&#39;</span></span>
  <span class='kw'>end</span>
  <span class='ivar'>@decoded_cookie</span> <span class='op'>=</span> <span class='id identifier rubyid_decoded_cookie'>decoded_cookie</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>

      <div id="footer">
  Generated on Thu Oct  3 11:49:14 2019 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.9.20 (ruby-2.6.2).
</div>

    </div>
  </body>
</html>